export default {
  setCookie(name,value,expiredays) {
    var str = name + "=" + encodeURIComponent(value);//这里对保存的数据进行编码
    var exp = new Date();
    exp.setTime(exp.getTime() + expiredays * 24 * 60 * 60 * 1000);
    str += ";expires=" + exp.toGMTString();
    document.cookie = str;
  },
  getCookie(name){
    var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
    if(arr=document.cookie.match(reg))
      return unescape(arr[2]);
    else
      return null;
  },
  delCookie(name) {
    this.setCookie(name, '', -1);
  }
}
